cmake_minimum_required(VERSION 3.5)

project(PointCloudSegmentation VERSION 0.1 LANGUAGES CXX)

# 设置策略 CMP0144
if(POLICY CMP0144)
    cmake_policy(SET CMP0144 NEW)
endif()

# 设置策略 CMP0074
if(POLICY CMP0074)
    cmake_policy(SET CMP0074 NEW)
endif()

# 设置策略 CMP0167
if(POLICY CMP0167)
    cmake_policy(SET CMP0144 NEW)
endif()

# set(CMAKE_AUTOUIC ON)
# set(CMAKE_AUTOMOC ON)
# set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 指定输出exe的目录
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
# 指定资源目录
set(RESOURCE_DIR ${CMAKE_SOURCE_DIR}/res)

file(COPY ${RESOURCE_DIR}/1.ply DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})

file(TO_CMAKE_PATH "$ENV{HALCONEXAMPLES}" HALCONEXAMPLES)
list(APPEND CMAKE_MODULE_PATH "${HALCONEXAMPLES}/cmake")

include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

# Option for using HALCON XL.
option(HALCON_XL "Use HALCON XL" OFF)

# Include common settings for HALCON projects.
include(UseHALCON)

find_package(PCL 1.8 REQUIRED)


file (GLOB SRC_FILES ${CMAKE_SOURCE_DIR}/*.cpp *.h *.hpp)

set(PROJECT_SOURCES
        ${SRC_FILES}
)

# 添加库目录
link_directories(${CMAKE_SOURCE_DIR}/lib)

add_executable(${PROJECT_NAME} ${PROJECT_SOURCES})
# 添加可执行文件

target_include_directories(${PROJECT_NAME}
    PRIVATE
        ${CMAKE_SOURCE_DIR}
)

target_link_libraries(${PROJECT_NAME}
    PUBLIC
        HALCON::CppInt
        ${PCL_LIBRARIES}
)

